package com.ruowei.modules.webSocket.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import com.ruowei.modules.webSocket.domain.enumeration.*;

import javax.persistence.*;

import java.io.Serializable;
import java.time.Instant;


/**
 * 消息推送情况
 */
@ApiModel(description = "消息推送情况")
@Entity
@Table(name = "message_push")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class MessagePush implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 推送编码
     */
    @ApiModelProperty(value = "推送编码")
    @Column(name = "push_code")
    private String pushCode;

    /**
     * 消息编码
     */
    @ApiModelProperty(value = "消息编码")
    @Column(name = "message_code")
    private String messageCode;

    /**
     * 接收方类型
     */
    @ApiModelProperty(value = "接收方类型")
    @Enumerated(EnumType.STRING)
    @Column(name = "receiver_type")
    private ReceiverType receiverType;

    /**
     * 推送时间
     */
    @ApiModelProperty(value = "推送时间")
    @Column(name = "push_time")
    private Instant pushTime;

    /**
     * 是否推送成功
     */
    @ApiModelProperty(value = "是否推送成功")
    @Column(name = "pushed")
    private Boolean pushed;

    /**
     * 是否已读
     */
    @ApiModelProperty(value = "是否已读")
    @Column(name = "jhi_read")
    private Boolean read;

    /**
     * 已读时间
     */
    @ApiModelProperty(value = "已读时间")
    @Column(name = "read_time")
    private Instant readTime;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getPushCode() {
        return pushCode;
    }

    public MessagePush pushCode(String pushCode) {
        this.pushCode = pushCode;
        return this;
    }

    public void setPushCode(String pushCode) {
        this.pushCode = pushCode;
    }

    public String getMessageCode() {
        return messageCode;
    }

    public MessagePush messageCode(String messageCode) {
        this.messageCode = messageCode;
        return this;
    }

    public void setMessageCode(String messageCode) {
        this.messageCode = messageCode;
    }

    public ReceiverType getReceiverType() {
        return receiverType;
    }

    public MessagePush receiverType(ReceiverType receiverType) {
        this.receiverType = receiverType;
        return this;
    }

    public void setReceiverType(ReceiverType receiverType) {
        this.receiverType = receiverType;
    }

    public Instant getPushTime() {
        return pushTime;
    }

    public MessagePush pushTime(Instant pushTime) {
        this.pushTime = pushTime;
        return this;
    }

    public void setPushTime(Instant pushTime) {
        this.pushTime = pushTime;
    }

    public Boolean isPushed() {
        return pushed;
    }

    public MessagePush pushed(Boolean pushed) {
        this.pushed = pushed;
        return this;
    }

    public void setPushed(Boolean pushed) {
        this.pushed = pushed;
    }

    public Boolean isRead() {
        return read;
    }

    public MessagePush read(Boolean read) {
        this.read = read;
        return this;
    }

    public void setRead(Boolean read) {
        this.read = read;
    }

    public Instant getReadTime() {
        return readTime;
    }

    public MessagePush readTime(Instant readTime) {
        this.readTime = readTime;
        return this;
    }

    public void setReadTime(Instant readTime) {
        this.readTime = readTime;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof MessagePush)) {
            return false;
        }
        return id != null && id.equals(((MessagePush) o).id);
    }

    @Override
    public int hashCode() {
        return 31;
    }

    @Override
    public String toString() {
        return "MessagePush{" +
            "id=" + getId() +
            ", pushCode='" + getPushCode() + "'" +
            ", messageCode='" + getMessageCode() + "'" +
            ", receiverType='" + getReceiverType() + "'" +
            ", pushTime='" + getPushTime() + "'" +
            ", pushed='" + isPushed() + "'" +
            ", read='" + isRead() + "'" +
            ", readTime='" + getReadTime() + "'" +
            "}";
    }
}
